﻿@model Poco.Zone

@{
    ViewBag.Title = "EditerZone";

    //prepare la dropdownlist des managers
    List<SelectListItem> serveurs = new List<SelectListItem>();

    if (ViewBag.serveurs != null)
    {
        foreach (Poco.Serveur m in ViewBag.serveurs)
        {
            serveurs.Add(new SelectListItem() { Text = m.Nom, Value = m.Id.ToString() });
        }
    }
    else
    {
        serveurs.Add(new SelectListItem() { Text = "Aucun Serveur", Value = "0" });
    }
}

<h2>EditerZone</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Zone</legend>

        @Html.HiddenFor(model => model.Id)

        <div class="editor-label">
            @Html.LabelFor(model => model.Numero)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Numero)
            @Html.ValidationMessageFor(model => model.Numero)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Description)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Description)
            @Html.ValidationMessageFor(model => model.Description)
        </div>

         <div class="editor-field">
            @Html.Label("Serveur en charge :")
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.Serveur.Nom, serveurs)
        </div>

        <p>
            <input type="submit" value="Enregistrer" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Retour à la liste", "Detail", new { id = Model.Restaurant.Id })
</div>
